package day;

import java.util.HashMap;
import java.util.Map;

/**
 * 292. Nim 游戏
 */
public class P292 {
    private Map<Integer, Boolean> map = new HashMap();

    public boolean canWinNim(int n) {
        if (1 <= n && n <= 3) {
            return true;
        } else if (n <= 0) {
            return false;
        }
        if (!map.containsKey(n - 4)) {
            boolean r = canWinNim(n - 4);
            map.put(n - 4, r);
        }
        return map.get(n - 4);
    }

    public static void main(String[] args) {
        boolean b = new P292().canWinNim(1348820612);
        System.out.println(b);
    }
}
